#ifndef MBCOMMUNICATION_H
#define MBCOMMUNICATION_H
#include "configs.h"
#include "libmodbus/modbus.h"
#include <QThread>
#include <QMap>

class MBCommunication : public QThread
{
    Q_OBJECT
public:
    enum COMType{COMInput,COMOutput};
    MBCommunication(COMType types, SerialConfigs *serial, uint16_t *data);
    ~MBCommunication();


private:
    COMType comtype;
    SerialConfigs *serial;
    uint16_t *database;
    modbus_mapping_t *mb_mapping;
    QMap<int,OutputConfigs *> map_outputs;
    modbus_t *mb;
    // QThread interface
protected:
    void run();
};

#endif // MBCOMMUNICATION_H
